﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MvcShop.Models.ViewDataModels;

namespace MvcShop.Models.Repositories
{
    public class HelperRepository:BaseRepositoryBase<Helper>, IHelperRepository<Helper>
    {
        public HelperRepository()
        {
            this.EntitiesSetName = "Helpers";
        }

        public IEnumerable<HelpList> GetHelpList(int page, int pageSize)
        {
            var query = (from hl in this.EntitySet
                         orderby hl.HelperId descending
                         select new HelpList { HelperId = hl.HelperId, 
                             HelperName = hl.HelperName })
                             .Skip((page - 1) * pageSize).Take(pageSize).ToList();
            return query;
        }
    }

    public class HelpCategoryRepository : BaseRepositoryBase<HelpCategory>, IHelpCategoryRepository<HelpCategory>
    {
        public HelpCategoryRepository()
        {
            this.EntitiesSetName = "HelpCategories";
        }
    }
}
